home *** CD-ROM | disk | FTP | other *** search
- *******************************************************************************
- * PROGRAM: Gettable.wfm
- *
- * WRITTEN BY: Borland Samples Group
- *
- * DATE: 3/95
- *
- * UPDATED: 6/95
- *
- * REVISION: $Revision: 1.14 $
- *
- * VERSION: Visual dBASE
- *
- * DESCRIPTION: This is a tool for selecting a table from a list of tables.
- *
- * PARAMETERS: None
- *
- * CALLS: Buttons.cc (Custom Controls file)
- *
- * USAGE: DO Gettable.wfm
- *
- ********************************************************************************
-
- #include <Messdlg.h>
-
-
- ** END HEADER -- do not remove this line*
- * Generated on 04/13/95
- *
- parameter bModal
- local f
- f = new GETTABLEFORM()
- if (bModal)
- f.mdi = .F. && ensure not MDI
- f.ReadModal()
- else
- f.Open()
- endif
- CLASS GETTABLEFORM OF FORM
- set procedure to &_dbwinhome.custom\Buttons.cc additive
- this.ColorNormal = "N/BTNFACE"
- this.OnClose = CLASS::FORM_ONCLOSE
- this.Top = 1
- this.Left = 5
- this.TopMost = .F.
- this.Text = "Table Selection"
- this.Height = 11.4111
- this.Width = 51.333
- this.PageNo = 1
- this.OnOpen = CLASS::ONOPEN
-
- DEFINE RECTANGLE RADIORECT OF THIS;
- PROPERTY;
- ColorNormal "BTNTEXT/BTNFACE",;
- Top 1.5,;
- Left 28.333,;
- Text "",;
- Height 5.3232,;
- Width 23,;
- PageNo 1,;
- Border .T.
-
- DEFINE RECTANGLE TABLESRECT OF THIS;
- PROPERTY;
- ColorNormal "B/BtnFace",;
- Top 1.1992,;
- Left 0.3311,;
- Text "Select a Table:",;
- Height 10.1533,;
- Width 27.1689,;
- PageNo 1,;
- Border .T.,;
- FontBold .F.
-
- DEFINE TEXT DIRECTORYTEXT OF THIS;
- PROPERTY;
- ColorNormal "W+/BTNFACE",;
- Top 0.1973,;
- Left 0.3311,;
- Text "",;
- Height 0.7432,;
- Width 42.002,;
- PageNo 1,;
- Border .F.,;
- FontBold .F.
-
- DEFINE LISTBOX TABLELIST OF THIS;
- PROPERTY;
- ColorHighLight "B+/W",;
- ColorNormal "WindowText/Window",;
- OnLeftDblClick CLASS::OKBUTTON1_ONCLICK,;
- Sorted .T.,;
- ID 100,;
- Top 1.8994,;
- Left 1.3311,;
- Height 9.3,;
- Width 25.335,;
- PageNo 1,;
- DataSource "TABLES",;
- FontBold .F.,;
- OnOpen {;this.curSel = 1}
-
- DEFINE PUSHBUTTON DIRECTORYBUTTON OF THIS;
- PROPERTY;
- ColorNormal "BtnText/BtnFace",;
- Top 5,;
- Left 36.3281,;
- Group .T.,;
- Text "&Directory",;
- Height 1.5293,;
- OnClick CLASS::DIRECTORYBUTTON_ONCLICK,;
- UpBitmap "RESOURCE #137",;
- Width 14.1719,;
- PageNo 1,;
- FontBold .F.
-
- DEFINE RADIOBUTTON DIRRADIO OF THIS;
- PROPERTY;
- Value .T.,;
- ColorNormal "BTNTEXT/BTNFACE",;
- Top 1.8994,;
- Left 29,;
- Group .T.,;
- Text "Tables from D&irectory",;
- Height 0.8057,;
- Width 20,;
- PageNo 1,;
- FontBold .F.,;
- OnChange CLASS::DIRRADIO_ONCHANGE
-
- DEFINE RADIOBUTTON DATABASERADIO OF THIS;
- PROPERTY;
- Value .F.,;
- ColorNormal "BTNTEXT/BTNFACE",;
- Top 2.7998,;
- Left 29,;
- Group .F.,;
- Text "Tables from D&atabase",;
- Height 0.8467,;
- Width 20,;
- PageNo 1,;
- FontBold .F.,;
- OnChange CLASS::DATABASERADIO_ONCHANGE
-
- DEFINE PUSHBUTTON DATABASEBUTTON OF THIS;
- PROPERTY;
- ColorNormal "BtnText/BtnFace",;
- Top 5,;
- Left 36.3281,;
- Group .T.,;
- Visible .F.,;
- Text "&Login...",;
- Height 1.5293,;
- UpBitmap "RESOURCE #137",;
- Width 14.1719,;
- PageNo 1,;
- FontBold .F.,;
- OnClick CLASS::DATABASEBUTTON_ONCLICK
-
-
- DEFINE ENTRYFIELD DATABASEENTRY OF THIS;
- PROPERTY;
- Value "",;
- ColorHighLight "WINDOWTEXT/WINDOW",;
- ColorNormal "N/W",;
- Top 3.6996,;
- Function "!S25",;
- Left 29,;
- Height 1.0293,;
- Width 21.5,;
- PageNo 1,;
- Border .T.,;
- FontBold .F.
-
- DEFINE OKBUTTON OKBUTTON1 OF THIS;
- PROPERTY;
- Top 8,;
- Left 36.332,;
- Group .T.,;
- Height 1.5293,;
- OnClick CLASS::OKBUTTON1_ONCLICK,;
- Width 14.168,;
- FontBold .F.
-
- DEFINE CANCELBUTTON CANCELBUTTON1 OF THIS;
- PROPERTY;
- Top 9.7998,;
- Left 36.332,;
- Group .T.,;
- Height 1.5527,;
- Width 14.168,;
- FontBold .F.
-
-
-
- Procedure OnOpen
- ****************************************************************************
-
- set procedure to &_dbwinhome.utils\Sql.wfm additive && Procedure file
-
- form.saveDir = setto("directory")
- if empty(setto("database"))
- form.dirRadio.SetFocus()
- form.directoryText.text = lower(form.saveDir)
- form.tablesFromDatabase = .F. && Indicates if tables are from database
- form.serverName = .F.
- else
- form.databaseRadio.SetFocus()
- form.databaseButton.OnClick()
- form.serverName = setto("database")
- endif
-
-
- ****************************************************************************
-
- Procedure Form_OnClose
- ****************************************************************************
- private saveDir
-
- close procedure &_dbwinhome.custom\Buttons.cc, &_dbwinhome.utils\Sql.wfm
-
- if form.tablesFromDatabase
- form.serverName = rtrim(form.databaseEntry.value)
- endif
- saveDir = form.saveDir
- cd &saveDir
-
-
- ****************************************************************************
-
- Procedure OkButton1_OnClick
- ****************************************************************************
- private curDir
-
- if form.tablesFromDatabase
- form.selectedTable = form.tableList.Selected()
- else
- curDir = setto("directory") + "\"
- form.selectedTable = upper(curDir + form.tableList.Selected())
- endif
-
- form.Close()
-
- ****************************************************************************
-
- Procedure DirectoryButton_OnClick
- ****************************************************************************
-
- private tablesDir
-
- tablesDir = getdirectory()
- if .not. empty(tablesDir)
- cd &tablesDir
- endif
-
- *** Changes aren't registered unless lisbox is completely redefined
- REDEFINE LISTBOX TABLELIST OF FORM;
- PROPERTY;
- ColorNormal "WindowText/Window",;
- OnLeftDblClick CLASS::OKBUTTON1_ONCLICK,;
- Height 9.3,;
- Left 1.332,;
- FontBold .F.,;
- DataSource "TABLES",;
- ColorHighLight "B+/W",;
- ID 100,;
- PageNo 1,;
- Top 1.8232,;
- OnOpen {;this.curSel = 1},;
- Width 25.334
- show object form.tableList
- form.tableList.curSel = 1
- form.tableList.SetFocus()
-
- form.directoryText.text = lower(tablesDir)
-
-
- *******************************************************************************
- Procedure DATABASEBUTTON_OnClick
- *******************************************************************************
- private databaseName
-
- databaseName = form.databaseEntry.value
- on error HandleDatabaseError()
- open database &databaseName
- set database to &databaseName
- databaseName = setto("database")
- if .not. empty(databaseName)
- form.directoryText.text = databaseName
- show object form.tableList
- else
- form.databaseEntry.value = ""
- form.dirRadio.SetFocus()
- endif
- on error
-
- ****************************************************************************
-
- Procedure DIRRADIO_OnChange
- ****************************************************************************
-
- form.directoryButton.visible = this.Value
- if this.Value
- form.databaseEntry.value = ""
- show object form.databaseEntry
- endif
- form.databaseEntry.enabled = .not. this.Value
- form.tablesFromDatabase = .not. this.Value
-
-
- ****************************************************************************
-
- Procedure DATABASERADIO_OnChange
- ****************************************************************************
-
- form.databaseButton.visible = this.Value
- form.databaseEntry.enabled = this.Value
- if this.Value
- form.databaseEntry.SetFocus()
- endif
- form.tablesFromDatabase = this.Value
-
-
-
-
- ENDCLASS
-
-
-
-
-
-
-